<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text">

    <script>
        var search = document.querySelector('input');
        document.addEventListener('keyup', function (e) {
            //keydown是按下的时候触发，弹起来会把s输入进去
            //keyup是弹起来的时候触发，点击松开后才会获得焦点
            // console.log(e.keyCode);  
            if (e.keyCode === 83) {  //按下s键，光标定位到文本框里面
                search.focus();
            }


        })


    </script>
</body>

</html>